package com.wty.design.structural.composite;

/**
 * @Author wangtengyu
 * @Create 2018-09-19-15:20
 * 课程类
 */
public class Course extends  CatalogComponent{
    private String name;
    private int price;

    public Course(String name, int price) {
        this.name = name;
        this.price = price;
    }

    @Override
    public String getName(CatalogComponent catalogComponent) {
        return this.name;
    }

    @Override
    public int getPrice(CatalogComponent catalogComponent) {
        return this.price;
    }

    @Override
    public void print() {
        System.out.println("name: "+this.name+" price "+this.price);
    }
}
